<template lang="html">
  <div class="store">
    <div @click='tomap(index)' v-for="(item,index) in result" class="">
      <div class="wrap_head">
        <div class="title">
          {{ item.name }}
        </div>
        <div class="dist">
          {{ parseInt(item.distance/100)/10+'km'}}
        </div>
      </div>
      <div class="wrap_mid">
        <div class="address">
          {{ item.address }}
        </div>
        <div class="">
          <i class="el-icon-arrow-right"></i>
        </div>
      </div>
      <div class="wrap_mid">
        <div class="address">
          {{ item.tel }}
        </div>
        <div class="">
          <i class="el-icon-arrow-right"></i>
        </div>
      </div>
      <div class="wrap_bottom">
          {{ item.tradetime }}
      </div>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import bus from '../js/bus'



Vue.prototype.$ELEMENT = { size: 'small' }
export default {
  data(){
    return{
      result:{},
      code:0
    }

  },
  created(){
    this.axios.get('http://txspring.cn:8080/getBj').then(data => {
        // 把请求到的数据交给该实例的属性
        this.result = data.data.data.storeList;
        console.log(data.data.data.storeList);
    })
    bus.$on('navzhi',data=>{
      console.log(data);
      this.result = data[0];
      this.code = data[1]

    })
    bus.$on('navzhi2',data=>{
      console.log(data);
      this.result = data[0];
      this.code = data[1]
    })
    bus.$on('navzhi0',data=>{
      console.log(data);
      this.result = data[0];
      this.code = data[1]
    })
  },
  methods:{
      tomap(n){
        // console.log(n);
        // bus.$emit('stroel',n);
        this.$router.push({
          path:'/map',
          query:{
            name:n,
            key:this.code
          }
        })
      }
  }
}
</script>


<style lang="css" scoped>
  .store{
    text-align: left;
    width: 95%;
    margin: 0 auto;
  }
  .wrap_head,.wrap_mid,wrap_bottom{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .4rem;

  }
  .wrap_head{
    height: 3.1rem;
  }
  .title{
    font-size: 16px;
    font-weight: 500;
  }
</style>
